using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace EIMS.Models
{
    /// <summary>
    /// 部门实体类
    /// </summary>
    public class Department
    {
        [Key]
        public int Id { get; set; }

        [Required(ErrorMessage = "部门名称不能为空")]
        [MaxLength(50, ErrorMessage = "部门名称不能超过50个字符")]
        [Display(Name = "部门")]
        public string Name { get; set; } = string.Empty;

        [MaxLength(200, ErrorMessage = "部门描述不能超过200个字符")]
        [Display(Name = "部门描述")]
        public string Description { get; set; } = string.Empty;

        [Display(Name = "创建时间")]
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        [Display(Name = "更新时间")]
        public DateTime? UpdatedAt { get; set; }

        // 导航属性 - 该部门的所有员工
        public virtual ICollection<Employee> Employees { get; set; } = new List<Employee>();
    }
} 